package com.briup.dao.impl;

import java.util.List;

import org.apache.ibatis.session.SqlSession;

import com.briup.bean.Category;
import com.briup.bean.CategoryDetail;
import com.briup.dao.ICategoryDao;
import com.briup.util.DBTool;

public class ICategoryDaoImpl implements ICategoryDao{

	@Override
	public List<Category> listAllCates() {
		SqlSession session = DBTool.getSession();
		List<Category> categorys = session.selectList("s_cate.selectAll");
		for (Category temp:categorys) {
			for (CategoryDetail temp1 : temp.getDetail()) {
				System.out.println(temp1);
			}
		}
		session.commit();
		session.close();
		
		return categorys;
	}
	
	public static void main(String[] args) {
		ICategoryDao dao = new ICategoryDaoImpl();
		dao.listAllCates();
	}
	
}
